Trains runs regularly from Nuremberg and take about 20 min. Bamberg is about 30 min away in the other direction. Most ICE trains between Munich and Berlin stop in Erlangen.